perm filename 206MAC.PUB[206,LSP]1 blob
sn#482123 filedate 1979-10-14 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00005 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 .<< Feature summary
C00008 00003 .MACRO STANDARD FRONT(SECPRINT, SSPRINT, PAGEPRINT, INDEXCHAR) ⊂
C00011 00004 .<< Pub macros for making CS206 handouts >>
C00014 00005 .<< The current font conventions for lisping are
C00019 ENDMK
C⊗;
.<< Feature summary
.Start with
.require "lspmac.pub[lsp,clt]" source;
.>>
.<<good ideas in MACROS.PUB[PAP,REF]>>
.<< This is a version of lsp.pub[1,clt] used for pubbing LISP notes etc. that
. allows you to turn on features selectively. There are three levels of FONT
. selection. item counting, eqn counting, Section and Subsection handling
. can be turned on by itemmac, eqnmac, and standard front. Fonts can be turned
. on by lspfont and fffont. The LISP operator text responses can be turned on
. basicops and allops.
.>>
.DEVICE XGP;
.pagehigh←54; pagewide←80;
.PAGE FRAME pagehigh HIGH pagewide WIDE;
.evenleftborder ← oddleftborder ← 1000;
.area text lines 4 to pagehigh;
.title area heading lines 1 to 3
.place text;
.sname←null;
.every heading(, {sname}, {page}) ;
.
.TURN ON "α%"; turn on "_" for "#" ;
.
.<<Basic fonts always on>>
.FONT 1 "BAXL30.FNT[FNT,CLT]"; << has improved ¬ >>
.FONT 2 "BAXM30";
.FONT 3 "baxb30.fnt[fnt,clt]"; << "|" in this file is a 4 pixel space>>
.FONT 6 "gacs25";
.
.<<Additional fonts sufficient for most LISP documents>>
.macro LSPFONT ⊂
.FONT 4 "SUB";
.FONT 5 "SUP";
.FONT 8 "SYMB30.FNT[FNT,CLT]"; <<has collection of all symbols from Math30,grk30,and
. ms25 that are used in the book
. grk symbols have original correspondence,
. circle-c is called @, * is times op, # is cross-prod
. | is bottom, & is integral sign, ∞ is the
. section symbol, π is the ¬ε symbol>>
. ⊃
.
.<< These are used for FOL documents and figure making>>
.macro FFFONT ⊂
.FONT 7 "NGR20";
.FONT C "GRFX25";
.FONT D "GRFX35";
. ⊃
.
.MACRO GET(FILE) ⊂ BEGIN "FILE" REQUIRE "FILE" SOURCE_FILE
.END "FILE" ⊃
.
.macro cb(head) ⊂ if lines<7 then next page else skip; once center; select 3
head
.⊃
.macro bb(head) ⊂ if lines<7 then next page else skip; once select 3
head
.⊃
.
.MACRO eqnmac ⊂
.count eqn inline from 1 to 999 in subsection ;
.at "!eqn" lab " " ⊂ turnon "{}";
.next eqn;
.eval("lab"&":") "("& subsection & "." & eqn & ")";
.eval("lab"&"!:") subsection & "." & eqn;
.eval("lab"&"!!:") section! & "." & subsection & "." & eqn;
."{subsection}.{eqn})"; turnoff ⊃
.
.<<formulas are signalled by !eqn followed by an optional identifier followed
.by the formula. Formulas are counted within subsections.
.A reference to formula nn in its defining subsection is written {eqn nn}
.A reference in a different subsection within a section is written {eqn nn!}
.A reference in a different section is written {eqn nn!!}
.!eqne1 x=x
.!eqne2 y=y
.
.Equation {eqn e2} comes after {eqn e1}.
.NB!!! "{" must be turned on for the reference to work.
.>>
. ⊃
.
.MACRO figmac ⊂
.count fig from 1 to 999;
.at "!fig" lab " " col "." ⊂
.lab next fig
.if col=0 then begin center turnon "{}"
%CFigure {fig}.%*
.turnoff end
.else begin turnon "∂{}"
∂(col)%CFigure {fig}.%*
.turnoff end;
.skip 2 ⊃
. ⊃
.
.<<figures are labeled by doing "!figid: n." where id is an optional identifier
.":" is needed to make the label assignment work and "n" it the column where the
.figure title is to begin. If n=0 it is centered. A reference to figure fn is
.written {fig fn}. NB!!! "{" must be turned on for the reference to work.
.>>
.
.MACRO itemmac (SUBITEMFLAG) ⊂
.count item
.at "#." ⊂ NEXT ITEM; (ITEM!); "."; ⊃
.IF "SUBITEMFLAG" ≠ NULL THEN START
.count subitem inline in item
.at "##." ⊂ NEXT SUBITEM; (ITEM!); "."; (SUBITEM!); "."; ⊃
.END;;
. ⊃
.MACRO STANDARD FRONT(SECPRINT, SSPRINT, PAGEPRINT, INDEXCHAR) ⊂
.IF "SECPRINT" ≠ NULL THEN START
. COUNT SECTION PRINTING "SECPRINT"
. MACRO s(NAME) ⊂ sname ← SSNAME ← NULL ;
. NEXT PAGE; NEXT SECTION;
. BEGIN turn on "{";
. CENTER select 3;
Chapter {!}
. SKIP
NAME
. SKIP;
. sname ← "CHAPTER " & SECTION!
. SEND CONTENTS ⊂ SKIP 1; IF LINES ≤ 8 THEN NEXT PAGE;
{SECTION!}∂6NAME
. ⊃
. END ⊃
. END ;
.IF "SSPRINT" ≠ NULL THEN START
. COUNT SUBSECTION IN SECTION PRINTING "SSPRINT"
. MACRO SS(NAME) ⊂ SSNAME←"NAME";
. IF LINES<8 THEN NEXT PAGE; NEXT SUBSECTION;
. START
. FILL SKIP 2 TURN ON "{∂∞→\"
. SEND CONTENTS ⊂
∂(8){SUBSECTION!}∂(12)NAME\\∞ ∞ ∞ ∞.→ {PAGE}
. ⊃
. END
{!}.__%3NAME%1
. SKIP;
. TURN OFF ; ⊃
. END;
.IF "PAGEPRINT" ≠ NULL THEN COUNT PAGE IN SECTION PRINTING "PAGEPRINT"
.IF "INDEXCHAR" = NULL THEN indexing←false else START
. indexing←true;
. AT INDEXING PHRASE INDEXING ⊂
. "PHRASE" ; TURN ON "{"
. SEND INDEX ⊂}<<{PAGE}_PHRASE_{⊃
. TURN OFF ⊃
. END;
. ⊃
.
.MACRO BACK ⊂
.sname ← SSNAME ← NULL
.IF INDEXING THEN START
. PORTION INDEX
. WASWORD ← WASLETT ← WASPG ← NULL ;
. AT "<<" PGNO "#" PHRASE "#" ⊂ LETT ← "PHRASE"[1] ;
. IF LETT ≠ WASLETT THEN IF LINES<6 THEN NEXT PAGE ELSE SKIP 2 ;
. IF "PHRASE" ≠ WASWORD THEN START BREAK }PHRASE__PGNO{ END
. ELSE IF "PGNO" ≠ WASPG THEN },_PGNO{ ;
. WASPG ← "PGNO" ; WASLETT ← LETT ; WASWORD ← "PHRASE" ; ⊃
. NOFILL turn on "←→∂\∞"; INDENT 0,0 PREFACE 0
←INDEX
. SKIP 4
. sname ← "INDEX"
. RECEIVE "##"
. sname ← NULL
. END
.COUNT PAGE PRINTING "i"
.PORTION CONTENTS
.FILL NOJUST; CRBREAK turn on "←→∂\∞";
.INDENT 0,25,10 PREFACE 1 TABS 20,24,28,32,36,40,44,48,52,56,60,64,68,72
.once center select 3;
Table of Contents
.SKIP 2
→Page
.SKIP;
.sname ← "Table of Contents"
.RECEIVE
. ⊃
.
.<< Pub macros for making CS206 handouts >>
.MACRO hd206 (TERM) ⊂
.BEGIN NOFILL TURNON "←→"
.place heading
←COMPUTER SCIENCE DEPARTMENT
←STANFORD UNIVERSITY
.place text
CS206 ←RECURSIVE PROGRAMMING AND PROVING →TERM
.TURNOFF
.END ⊃
.
.MACRO hw (NUMBER, DUEDATE) ⊂
. BEGIN TURNON "←" NOFILL
←PROBLEM SET NUMBER
←Due DUEDATE
. TURNOFF END ⊃
.
.
.
.MACRO fact ⊂
. MACRO instr (NAME , OFFICEandPHONE , OFFICE_HOURS) ⊂
. BEGIN TURNON "∂" NOFILL
Instructor:∂(16)NAME
∂(4)Office:∂(16)OFFICEandPHONE
Hours:∂(16)OFFICE_HOURS
. TURNOFF
. END ⊃
.
.
. MACRO ta (NAME , OFFICEandPHONE , OFFICE_HOURS) ⊂
. BEGIN TURNON "∂" NOFILL
TA: ∂(16)NAME
∂(4)Office:∂(16)OFFICEandPHONE
∂(4)Hours:∂(16)OFFICE_HOURS
. TURNOFF
. END ⊃
.
.
. MACRO meet (WHEN , WHERE) ⊂
. BEGIN TURNON "∂" NOFILL
Course Meets:∂(16)WHEN
∂(16)WHERE
. TURNOFF
. END ⊃
.
.
. MACRO work (MUMBLE) ⊂
. BEGIN FILL INDENT 0 , 8
Course Work:
MUMBLE
. END ⊃
.
.
. MACRO books (T) ⊂
. BEGIN NOFILL TURNON "∂{}"
.FOO ← "T"
.BAZ ← SCAN(FOO,"@","","IS")
Texts:∂(16){BAZ}
. REPEAT ⊂IF FOO=NULL THEN DONE ELSE BAZ ← SCAN(FOO,"@","", "IS");
∂(16){BAZ}
. ⊃
.
.skip
∂(20)Texts are available at the bookstore.
. TURNOFF
. END ⊃
.
.
. MACRO comp (MUMBLE) ⊂
. BEGIN FILL INDENT 0,8
Computer:
MUMBLE
. END ⊃
.
.BEGIN TURNON "←"
.SKIP
←COURSE FACTS
.SKIP
.TURNOFF
.END
. ⊃
.<< The current font conventions for lisping are
. S-expressions internal form delimited by "$$" ... "$"
. words " " flagged by "$"
. S-expressions external form delimited by "⊗⊗" ... "⊗"
. words " " flagged by "⊗"
. Operators, reserved words and other special symbols are flagged by
. "q" and those that are prefix must be followed by a <space> which
. gets shortened. The exceptions are a, d, n and at where
. qqa, qqd, qqn and qqat will not effect any following space.
. eg. they may stand alone in text with out an argument following.
.>>
.macro allops ⊂
.
.at "qaaaa " ⊂"%3aaaa|%*"⊃
.at "qaaad " ⊂"%3aaad|%*"⊃
.at "qaada " ⊂"%3aada|%*"⊃
.at "qaadd " ⊂"%3aadd|%*"⊃
.at "qadaa " ⊂"%3adaa|%*"⊃
.at "qadad " ⊂"%3adad|%*"⊃
.at "qadda " ⊂"%3adda|%*"⊃
.at "qaddd " ⊂"%3addd|%*"⊃
.at "qdaaa " ⊂"%3daaa|%*"⊃
.at "qdaad " ⊂"%3daad|%*"⊃
.at "qdada " ⊂"%3dada|%*"⊃
.at "qdadd " ⊂"%3dadd|%*"⊃
.at "qddaa " ⊂"%3ddaa|%*"⊃
.at "qddad " ⊂"%3ddad|%*"⊃
.at "qddda " ⊂"%3ddda|%*"⊃
.at "qdddd " ⊂"%3dddd|%*"⊃
.at "qaaa " ⊂"%3aaa|%*"⊃
.at "qaad " ⊂"%3aad|%*"⊃
.at "qada " ⊂"%3ada|%*"⊃
.at "qadd " ⊂"%3add|%*"⊃
.at "qdaa " ⊂"%3daa|%*"⊃
.at "qdad " ⊂"%3dad|%*"⊃
.at "qdda " ⊂"%3dda|%*"⊃
.at "qddd " ⊂"%3ddd|%*"⊃
.
.⊃
.
.macro basicops ⊂
.at "qNIL" ⊂"%6NIL%*"⊃
.at "qnil" ⊂"%6NIL%*"⊃
.at "qT" ⊂"%6T%*"⊃
.at "qif" ⊂"%3if%*"⊃
.at "qthen" ⊂"%3then%*"⊃
.at "qelse" ⊂"%3else%*"⊃
.at "qeq" ⊂"%3eq%*"⊃
.at "qn " ⊂"%3n|%*"⊃
.at "qat " ⊂"%3at|%*"⊃
.at "qaa " ⊂"%3aa|%*"⊃
.at "qad " ⊂"%3ad|%*"⊃
.at "qda " ⊂"%3da|%*"⊃
.at "qdd " ⊂"%3dd|%*"⊃
.at "qa " ⊂"%3a|%*"⊃
.at "qd " ⊂"%3d|%*"⊃
.at "qqn" ⊂"%3n%*"⊃
.at "qqat" ⊂"%3at%*"⊃
.at "qqa" ⊂"%3a%*"⊃
.at "qqd" ⊂"%3d%*"⊃
.
.at "qtrue" ⊂"%3true%*"⊃
.at "qfalse" ⊂"%3false%*"⊃
.at "qprog" ⊂"%3program%*"⊃
.at "qreturn" ⊂"%3return%*"⊃
.at "qgo" ⊂"%3go_to%*"⊃
.at "qY" ⊂"%3Y%*"⊃
.
.at "qt" ⊂"%8t%*"⊃
.at "qW" ⊂"%8w%*"⊃
.at "qp" ⊂"%8f%*"⊃
.at "qP" ⊂"%8F%*"⊃
.at "qq" ⊂"%8y%*"⊃
.at "qr" ⊂"%8x%*"⊃
.at "qx" ⊂"%8x%*"⊃
.at "qF" ⊂"%8F%*"⊃
.at "qz" ⊂"%8z%*"⊃
.at "qh" ⊂"%8h%*"⊃
.at "qα" ⊂"%8a%*"⊃
.at "qβ" ⊂"%8b%*"⊃
.
.
.at "qsect" ⊂"%8∞%*"⊃
.at "qw" ⊂"%8|%*"⊃
.at "q≤" ⊂"%8≤%*"⊃
.at "q*" ⊂"%8*%*"⊃
. ⊃
.at "$$" SEXP "$" ⊂ g←"%"&thisfont; "%6SEXP"; TURNON "{}"; "{g}";TURNOFF; ⊃
.at "$" WORD " " ⊂ "%6WORD %*" ⊃
.at "⊗⊗⊗" bbexp "⊗" ⊂f←"%"&thisfont; TURNON "@" for "←"; "@%2bbexp"; TURNOFF;
.TURNON "{}"; "{f}"; TURNOFF;
.⊃
.at "⊗⊗" bbexp "⊗" ⊂ f←"%"&thisfont; "%2bbexp"; TURNON "{}"; "{f}";TURNOFF;⊃
.at "⊗"word" " ⊂ "%2word%* " ⊃